home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DATABASE / OBJ1_2.ZIP;1 / DEMO2.PRG < prev    next >
Encoding:
Text File  |  1993-01-08  |  4.5 KB  |  114 lines

  1. //*****************************************************************************
  2. //                                 Demo2.prg
  3. // ⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒø
  4. // ≥         Simple (trivial) demo application created with OBJECT.lib        ≥
  5. // ≥       Length of source code is (without notes) 75 lines, 2520 bytes      ≥
  6. // ¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
  7. //                        (c) 1991, JHK, JHK-Software, Piestany
  8. //
  9. //                Author:
  10. //                          Jan Hercek
  11. //                          JHK-Software
  12. //                          N.Teslu 26
  13. //                  92101   Piestany
  14. //                          Slovak republic
  15. //                          (in central Europe)
  16. //
  17. //                          (tel: +42/838/21782)
  18. //
  19. //                Compile with Clipper.exe, switches: /N/M/W/A
  20. //                Link command: RtLink FI Demo2 LIB Object
  21. //                          or: RtLink FI Demo2 PLL Object
  22. //*****************************************************************************
  23.  
  24. #include "Set.ch"
  25. #include "InKey.ch"
  26. #include "Object.ch"
  27.  
  28. static oD,oV,oS,oM      //objects: Database, View, mask (Say get), Menu
  29.  
  30. procedure Main(clr)
  31.   ObjectInit(clr,"Demo2",2,1992,"every Clipper programmer",,"evaluating version 0.02")
  32.   object oD of Dbf  init DInit()
  33.   object oV of View init VInit()
  34.   object oS of Mask init SInit()   //new "say_get" object
  35.   object oM of Menu init MInit()
  36.   oM:Process()
  37.   ObjectDone()
  38.   return
  39.  
  40. procedure DInit()
  41.   oD:AddDbf("Employ")
  42.   oD:AddField("Name", "C",20)
  43.   oD:AddField("Birth","D");     oD:ChValid({||Alert("Changed field"),true})  //validation after any change
  44.   oD:AddField("Pay",  "N",8,2); oD:Range(0,99000)  //range of good values
  45.   oD:AddField("Note", "M")
  46.   oD:AddNtx(,"Emp_name","Name")  //file_name,index_key
  47.   return
  48.  
  49. procedure VInit()
  50.   oV:Select("Employ")
  51.   oV:AddField("First & last name","Name", "field->Name")
  52.   oV:AddField("Annual pay",       "Pay",  "field->Pay")
  53.   oV:AddField("Birth date",       "Birth","field->Birth")
  54.   oV:AddMemo( "Remarks",          "Rem.", "field->Note")
  55.   *
  56.   oV:AddReport("~1.Employees")
  57.   oV:AddRTop("Short view of employees;(only names, pays and birth dates)")
  58.   oV:AddRField("First & last name","Name")
  59.   oV:AddRField("Annual pay",       "Pay",,true)
  60.   oV:AddRField("Birth date",       "Birth")
  61.   oV:AddRBottom("Created by Jan Hercek, Piestany")
  62.   *
  63.   oV:AddAction(K_ALT_U,{||Alert("User action in oV-object")},"ALT_U=Action")
  64.   oV:AddFilter("~1.Only records<5","RecNo()<5")
  65.   oV:SetConfirm(false) //local confirmation for this object
  66.   oV:IndexNo:=1        //local active index for this object
  67.   return
  68.  
  69. procedure SInit()                                    //say_get window, all next items are relative into the window.
  70.   oS:Select("Employ")                                //primary database
  71.   oS:DefWindow("Programmer defined window",,,10,48)  //Window_name,Row,Col,RowSize,ColSize
  72.   oS:AddSay( 2,11,"First and last name")             //Row,Col,Text
  73.   oS:AddSay( 4,13,"Annual pay")
  74.   oS:AddSay( 6,15,"Birth date")
  75.   oS:AddSay( 8,17,"Remarks")
  76.   oS:AddField( 3,12,"Name",   "field->Name")   //Row,Col,Column_title,Field_name
  77.   oS:AddField( 5,14,"Pay",    "field->Pay")
  78.   oS:AddField( 7,16,"Birth",  "field->Birth")
  79.   oS:AddMemo(  9,18,"Remarks","field->Note")
  80.   *
  81.   oS:AddAction(K_ALT_U,{||Alert("Action in oS-object")},"ALT_U=Action")
  82.   return
  83.  
  84. procedure MInit()
  85.   oM:AddBar("~File")
  86.     oM:AddView("~Employees","Employees", oV)
  87.     oM:AddView("E~mployees",, oS)                       //new object into the menu
  88.     oM:AddItem("Text ~file",   {||FInfoShow()})
  89.     oM:AddItem("E~xit  Alt-X", {||oM:Done()}, K_ALT_X)
  90.   oM:AddBar("~Archiv")
  91.     oM:AddItem("~Save on disk a:", {||oD:Save("a:")})
  92.     oM:AddItem("~Restore from disk a:", {||oD:Load("a:")})
  93.   oM:AddBar("~Problems?")
  94.     oM:AddItem("~Reindex", {||oD:ReIndex()})
  95.     oM:AddItem("~Pack", {||oD:Pack()})
  96.     oM:AddItem("~Change password", {|i|oM:Password(i)})
  97.     oM:AddCheck("~Wrap menu", {|i,v|Set(_SET_WRAP,v)})
  98.   return
  99.  
  100. //
  101. //All program is only linear describe of desired actions,
  102. //without any jumps, loops, ...
  103. //without any screen positionning commands,
  104. //with the minimal possibility to create any error.
  105. //
  106. //Remember: 
  107. //this is a NET version, a program created by with OBJECT.lib has NET capability
  108. //
  109. //Excuse me, please, for my terrible english. Many thanks.
  110. //(Have you any job for me?)
  111. //
  112. //˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ it is REALLY end of program ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙
  113.  
  114.